package com.realgodo.site.entity.space;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.realgodo.site.entity.IdEntity;
import com.realgodo.site.entity.security.User;

@Entity(name = "Space")
@Table(name = "space")
public class Space extends IdEntity {

	private static final long serialVersionUID = -2382490809728960060L;
	public static final int ALLOW_SEARCH = 1;
	public static final int NOE_ALLOW_SEARCH = 0;
	/** 共享信息:任何人 */
	public static final int SHOW_LEVEL_ANYONE = 0;
	/** 共享信息:注册用户 */
	public static final int SHOW_LEVEL_USER = 1;
	/** 共享信息:朋友 */
	public static final int SHOW_LEVEL_FRIENDS = 2;
	/** 共享信息:隐藏 */
	public static final int SHOW_LEVEL_HIDE = 3;
	/** 好友邀请:需要邮件通知 */
	public static final int NEED_FRIEND_EMAIL = 1;
	/** 好友邀请:不需要需要邮件通知 */
	public static final int NEEDLESS_FRIEND_EMAIL = 0;
	/** 通用设置:需要 */
	public static final int NEED = 1;
	/** 通用设置:不需要 */
	public static final int NEEDLESS = 0;
	private String domain;
	private String name;
	/** 等级 */
	private Integer level = 1;
	/** 是否需要好友通知email */
	private int isFriendEmail = NEED_FRIEND_EMAIL;
	/** 是否允许被搜索 */
	private int isAllowBeSearch = ALLOW_SEARCH;
	/** 新信息声音提示 */
	private int isSoubdNewMessage = NEEDLESS;
	/** 信息共享等级 */
	private int publishLevel = SHOW_LEVEL_ANYONE;
	private User user;

	private String notice;

	private String interduce;

	@Column(name = "domain")
	public String getDomain() {
		return domain;
	}

	public void setDomain(String domain) {
		this.domain = domain;
	}

	@Column(name = "name")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "is_friend_email")
	public int getIsFriendEmail() {
		return isFriendEmail;
	}

	public void setIsFriendEmail(int isFriendEmail) {
		this.isFriendEmail = isFriendEmail;
	}

	public Integer getLevel() {
		return level;
	}

	public void setLevel(Integer level) {
		this.level = level;
	}

	@ManyToOne
	@JoinColumn(name = "user_id", referencedColumnName = "id", nullable = false)
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public int getIsAllowBeSearch() {
		return isAllowBeSearch;
	}

	public void setIsAllowBeSearch(int isAllowBeSearch) {
		this.isAllowBeSearch = isAllowBeSearch;
	}

	public int getPublishLevel() {
		return publishLevel;
	}

	public void setPublishLevel(int publishLevel) {
		this.publishLevel = publishLevel;
	}

	public int getIsSoubdNewMessage() {
		return isSoubdNewMessage;
	}

	public void setIsSoubdNewMessage(int isSoubdNewMessage) {
		this.isSoubdNewMessage = isSoubdNewMessage;
	}

	@Column(name = "notice", length = 5000)
	public String getNotice() {
		return notice;
	}

	public void setNotice(String notice) {
		this.notice = notice;
	}

	@Lob
	@Basic(fetch = FetchType.LAZY)
	@Column(name = "interduce", insertable = true, updatable = true)
	public String getInterduce() {
		return interduce;
	}

	public void setInterduce(String interduce) {
		this.interduce = interduce;
	}

	
}
